import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ichinesereader/pages/common/knowledgeWords.dart';
import 'package:ichinesereader/pages/common/leaderBoard.dart';
import 'package:ichinesereader/pages/common/myBadges.dart';
import 'package:ichinesereader/pages/student/announcements.dart';
import 'package:ichinesereader/utils/helper.dart';
import 'package:ichinesereader/constants.dart';

class FloatingActionButtonsForHomeLowLevel extends StatelessWidget {
  FloatingActionButtonsForHomeLowLevel({
    Key? key,
    required this.isStudent,
  }) : super(key: key);

  final bool isStudent;

  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.end,
      children: <Widget>[
        isStudent
            ? SizedBox(
                height: 45,
                width: 45,
                child: FloatingActionButton(
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.all(Radius.circular(15.0))),
                  backgroundColor:
                      Get.isDarkMode ? Color(0xff2222222) : Color(0xff8db4f9),
                  heroTag: Text('myannouncements1111'.tr),
                  tooltip: 'Messages'.tr,
                  onPressed: () {
                    Get.to(() => StudentMyAnnouncements());
                  },
                  child: Icon(
                    Icons.message_rounded,
                    color: Get.theme.primaryColorLight,
                    size: 24,
                  ),
                  elevation: 0,
                  splashColor: Colors.grey,
                ),
              )
            : Text(''),
        SizedBox(width: 9.0),
        SizedBox(
          height: 45,
          width: 45,
          child: FloatingActionButton(
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(15.0))),
            backgroundColor:
                Get.isDarkMode ? Color(0xff2222222) : Color(0xff8db4f9),
            heroTag: Text('FlashCards111111'.tr),
            tooltip: 'Word Cards'.tr,
            onPressed: () {
              //Navigator.pushNamed(context, '/common/flashcards');
              Get.to(() => KnowledgeWordsPage());
            },
            child: Icon(
              Icons.translate,
              color: Get.isDarkMode
                  ? Get.theme.primaryColorLight
                  : Get.theme.primaryColorLight,
              size: 24,
            ),
            elevation: 0,
            splashColor: Colors.grey,
          ),
        ),
        SizedBox(width: 9.0),
        SizedBox(
          height: 45,
          width: 45,
          child: FloatingActionButton(
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(15.0))),
            backgroundColor:
                Get.isDarkMode ? Color(0xff2222222) : Color(0xff8db4f9),
            heroTag: Text(
              'Audio playlist111111'.tr,
            ),
            tooltip: 'Audio Playlist'.tr,
            onPressed: () {
              isStudent
                  ? Navigator.pushNamed(context, '/student/audiobooks')
                  : Navigator.pushNamed(context, '/individual/audiobooks');
            },
            child: Icon(
              Icons.music_note_rounded,
              color: Get.isDarkMode
                  ? Get.theme.primaryColorLight
                  : Get.theme.primaryColorLight,
              size: 24,
            ),
            elevation: 0,
            splashColor: Colors.grey,
          ),
        ),
        SizedBox(width: 9.0),
        SizedBox(
          height: 45,
          width: 45,
          child: FloatingActionButton(
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(15.0))),
            backgroundColor:
                Get.isDarkMode ? Color(0xff2222222) : Color(0xff8db4f9),
            heroTag: Text('badges111111'.tr),
            tooltip: 'Badges'.tr,
            onPressed: () {
              //Navigator.pushNamed(context, '/common/mybadges');
              Get.to(() => MyBadgesPage());
            },
            child: Icon(
              Icons.stars,
              color: Get.isDarkMode
                  ? Get.theme.primaryColorLight
                  : Get.theme.primaryColorLight,
              size: 24,
            ),
            elevation: 0,
            splashColor: Colors.grey,
          ),
        ),
        SizedBox(width: 9.0),
        SizedBox(
          height: 45,
          width: 45,
          child: FloatingActionButton(
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(15.0))),
            backgroundColor:
                Get.isDarkMode ? Color(0xff2222222) : Color(0xff8db4f9),
            heroTag: Text('leaderboard111111'.tr),
            tooltip: 'Leader Board'.tr,
            onPressed: () {
              Get.to(() => LeaderBoardPage());
            },
            child: Icon(
              Icons.leaderboard_rounded,
              color: Get.isDarkMode
                  ? Get.theme.primaryColorLight
                  : Get.theme.primaryColorLight,
              size: 24,
            ),
            elevation: 0,
            splashColor: Colors.grey,
          ),
        ),
        SizedBox(width: 9.0),
        SizedBox(
          height: 45,
          width: 45,
          child: FloatingActionButton(
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(15.0))),
            backgroundColor:
                Get.isDarkMode ? Color(0xff2222222) : Color(0xff8db4f9),
            heroTag: Text('Game and rewards111111'.tr),
            tooltip: 'Rewards'.tr,
            onPressed: () {
              if (GetPlatform.isWeb || GetPlatform.isMacOS) {
                launchInWebViewWithJavaScript('${Constants.BaseURL}game/');
              } else {
                Navigator.pushNamed(context, '/student/reward');
              }
            },
            child: Icon(
              Icons.videogame_asset,
              color: Get.isDarkMode
                  ? Get.theme.primaryColorLight
                  : Get.theme.primaryColorLight,
              size: 24,
            ),
            elevation: 0,
            splashColor: Colors.grey,
          ),
        ),
      ],
    );
  }
}
